about summary refs log tree commit diff
path: root/third_party
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-07-17T02·45+0100
committertazjin <mail@tazj.in>2020-07-17T19·03+0000
commit8d5857abbcbd70fdeb50151b7a05edf5673809d3 (patch)
tree62ad46fe1a19402446880c9e4568a05c4c94ad93 /third_party
parenta2870d05a31c6b0faaf43c24b98ffce4a09503d3 (diff)
chore(3p/nix): Remove builtins.exec r/1346
This is a bad idea, it shouldn't exist, nixpkgs doesn't use it.

Change-Id: Ic4d1b936d8f059d5c40f0567af165b02427d7e36
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1241
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Diffstat (limited to 'third_party')
-rw-r--r--third_party/nix/src/libexpr/primops.cc43
-rw-r--r--third_party/nix/src/libexpr/primops.hh2
2 files changed, 0 insertions, 45 deletions
diff --git a/third_party/nix/src/libexpr/primops.cc b/third_party/nix/src/libexpr/primops.cc
index d96af55f5c..6b3eaa4c08 100644
--- a/third_party/nix/src/libexpr/primops.cc
+++ b/third_party/nix/src/libexpr/primops.cc
@@ -207,48 +207,6 @@ void prim_importNative(EvalState& state, const Pos& pos, Value** args,
    * shared object file */
 }
 
-/* Execute a program and parse its output */
-void prim_exec(EvalState& state, const Pos& pos, Value** args, Value& v) {
-  state.forceList(*args[0], pos);
-  auto elems = args[0]->listElems();
-  auto count = args[0]->listSize();
-  if (count == 0) {
-    throw EvalError(format("at least one argument to 'exec' required, at %1%") %
-                    pos);
-  }
-  PathSet context;
-  auto program = state.coerceToString(pos, *elems[0], context, false, false);
-  Strings commandArgs;
-  for (unsigned int i = 1; i < args[0]->listSize(); ++i) {
-    commandArgs.emplace_back(
-        state.coerceToString(pos, *elems[i], context, false, false));
-  }
-  try {
-    state.realiseContext(context);
-  } catch (InvalidPathError& e) {
-    throw EvalError(
-        format("cannot execute '%1%', since path '%2%' is not valid, at %3%") %
-        program % e.path % pos);
-  }
-
-  auto output = runProgram(program, true, commandArgs);
-  Expr* parsed;
-  try {
-    parsed = state.parseExprFromString(output, pos.file.value());
-  } catch (Error& e) {
-    e.addPrefix(format("While parsing the output from '%1%', at %2%\n") %
-                program % pos);
-    throw;
-  }
-  try {
-    state.eval(parsed, v);
-  } catch (Error& e) {
-    e.addPrefix(format("While evaluating the output from '%1%', at %2%\n") %
-                program % pos);
-    throw;
-  }
-}
-
 /* Return a string representing the type of the expression. */
 static void prim_typeOf(EvalState& state, const Pos& pos, Value** args,
                         Value& v) {
@@ -2305,7 +2263,6 @@ void EvalState::createBaseEnv() {
   addConstant("import", v);
   if (evalSettings.enableNativeCode) {
     addPrimOp("__importNative", 2, prim_importNative);
-    addPrimOp("__exec", 1, prim_exec);
   }
   addPrimOp("__typeOf", 1, prim_typeOf);
   addPrimOp("isNull", 1, prim_isNull);
diff --git a/third_party/nix/src/libexpr/primops.hh b/third_party/nix/src/libexpr/primops.hh
index ad646e4d0b..45f63a5419 100644
--- a/third_party/nix/src/libexpr/primops.hh
+++ b/third_party/nix/src/libexpr/primops.hh
@@ -20,7 +20,5 @@ struct RegisterPrimOp {
 /* Load a ValueInitializer from a DSO and return whatever it initializes */
 void prim_importNative(EvalState& state, const Pos& pos, Value** args,
                        Value& v);
-/* Execute a program and parse its output */
-void prim_exec(EvalState& state, const Pos& pos, Value** args, Value& v);
 
 }  // namespace nix