1.1 --- a/fsaccess/op_run.c Sat May 11 22:28:21 2024 +0200
1.2 +++ b/fsaccess/op_run.c Sat May 11 23:53:52 2024 +0200
1.3 @@ -221,31 +221,7 @@
1.4 int last_job;
1.5 long err;
1.6
1.7 - /* Create a pipe for process output. */
1.8 -
1.9 - err = client_pipe(&output_reader, &output_writer, O_NONBLOCK);
1.10 -
1.11 - if (err)
1.12 - {
1.13 - printf("Could not obtain pipe for output: %s\n", l4sys_errtostr(err));
1.14 - return -1;
1.15 - }
1.16 -
1.17 - /* Start the process. */
1.18 -
1.19 - err = process_spawn(argc, (const char **) argv, input_reader, output_writer, &process);
1.20 -
1.21 - if (err)
1.22 - {
1.23 - printf("Could not start process: %s\n", l4sys_errtostr(err));
1.24 - return -1;
1.25 - }
1.26 -
1.27 - /* Release the relinquished end of the pipe. */
1.28 -
1.29 - client_close(output_writer);
1.30 -
1.31 - /* Record the output stream. */
1.32 + /* Find a job slot. */
1.33
1.34 last_job = next_job;
1.35
1.36 @@ -265,6 +241,33 @@
1.37 }
1.38 }
1.39
1.40 + /* Create a pipe for process output. */
1.41 +
1.42 + err = client_pipe(&output_reader, &output_writer, O_NONBLOCK);
1.43 +
1.44 + if (err)
1.45 + {
1.46 + printf("Could not obtain pipe for output: %s\n", l4sys_errtostr(err));
1.47 + return -1;
1.48 + }
1.49 +
1.50 + /* Start the process. */
1.51 +
1.52 + err = process_spawn(argc, (const char **) argv, input_reader, output_writer, &process);
1.53 +
1.54 + if (err)
1.55 + {
1.56 + printf("Could not start process: %s\n", l4sys_errtostr(err));
1.57 + process_free(process);
1.58 + return -1;
1.59 + }
1.60 +
1.61 + /* Release the relinquished end of the pipe. */
1.62 +
1.63 + client_close(output_writer);
1.64 +
1.65 + /* Record the output stream, process and command details. */
1.66 +
1.67 readers[next_job] = output_reader;
1.68 processes[next_job] = process;
1.69 programs[next_job] = strdup(argv[0]);