Run sh/shout/shlines in a temporary directory.
[goaljobs.git] / goaljobs.mli
index 072fcef..bc47f6d 100644 (file)
@@ -37,7 +37,7 @@
         let o_file = change_file_extension "o" c_file in
         target (more_recent [o_file] [c_file]);
 
-        sh "cc -c %s -o %s" c_file o_file
+        sh "cd $builddir && cc -c %s -o %s" c_file o_file
     }
 
     In the second example, the rule requires that several files
@@ -51,7 +51,7 @@
         require (compiled source);
 
         let object = change_file_extension "o" source in
-        sh "cc %s -o %s" object program
+        sh "cd $builddir && cc %s -o %s" object program
     }
 
 *)
@@ -211,11 +211,14 @@ val quote : string -> string
     {v command ||: }
     to ignore the result of a command.
 
-    Each shell runs in a new temporary directory.  The temporary directory
-    and all its contents is deleted after the shell exits.  If you
-    want to save any data, [cd] somewhere.  For example you could start
-    the command sequence with:
-    {v cd $HOME/data/ }
+    Each shell runs in a new temporary directory.  The temporary
+    directory and all its contents is deleted after the shell exits.
+    If you want to save any data, [cd] somewhere.  The environment
+    variable [$builddir] is exported to the script.  This is the
+    current directory when the goaljobs program was started.
+
+    For example you could start the command sequence with
+    [cd $HOME/data/] or [cd $builddir].
 *)
 
 val sh : ('a, unit, string, unit) format4 -> 'a
@@ -233,10 +236,8 @@ val shlines : ('a, unit, string, string list) format4 -> 'a
       Any lines printed to stdout is returned as a list of strings.
       Trailing [\n] characters are not returned. *)
 
-(*
 val shell : string ref
   (** Set this variable to override the default shell ([/bin/sh]). *)
-*)
 
 (** {2 String functions}