This version of the patch uses tokenizeString to parse, and only
tokenizes on newlines. This is STILL NOT TESTED, will report back once
I've tested it.
~Shea
On 08/08/2011 02:52 PM, [email protected] wrote:
Hi all,
This patch adds and documents the "--from-file" option which allows
parsing a file (or stdin) for additional arguments to the command. Note
that this patch is NOT YET TESTED, I'm sending it here while I work on
figuring out how to build nix from SVN in the hopes that someone might
already be equipped to do so and might test it in the mean time.
Cheers,
Shea Levy
_______________________________________________
nix-dev mailing list
[email protected]
https://mail.cs.uu.nl/mailman/listinfo/nix-dev
Forgot to mention why we care about this: This will allow us to avoid the
"argument list too long" problem with the default remote builder hook by
allowing us to send arguments via stdin.
_______________________________________________
nix-dev mailing list
[email protected]
https://mail.cs.uu.nl/mailman/listinfo/nix-dev
Index: nix/src/libmain/shared.cc
===================================================================
--- nix/src/libmain/shared.cc (revision 28396)
+++ nix/src/libmain/shared.cc (working copy)
@@ -251,6 +251,13 @@
string value = *i;
overrideSetting(name, tokenizeString(value));
}
+ else if (arg == "--from-file") {
+ ++i;
+ if (i == args.end()) throw UsageError("`--from-file' requires an
argument");
+ Strings fileArgs = tokenizeString(readFile(*i), "\n");
+ copy(fileArgs.begin, fileArgs.end,
+ back_insert_iterator<Strings>(args);
+ }
else remaining.push_back(arg);
}
Index: nix/doc/manual/opt-common.xml
===================================================================
--- nix/doc/manual/opt-common.xml (revision 28396)
+++ nix/doc/manual/opt-common.xml (working copy)
@@ -341,6 +341,16 @@
</varlistentry>
+<varlistentry><term><option>--from-file</option>
<replaceable>file</replaceable></term>
+
+ <listitem><para>This option reads newline-separated options
+ from <replacable>file</replacable> and adds them to the argument list.
+ This can be particularly useful if <replacable>file</replacable>
+ is /dev/stdin.</para></listitem>
+
+</varlistentry>
+
+
</variablelist>
_______________________________________________
nix-dev mailing list
[email protected]
https://mail.cs.uu.nl/mailman/listinfo/nix-dev