瀏覽代碼

ncd: examples: run_process_output: Convert to Do.

Ambroz Bizjak 11 年之前
父節點
當前提交
cbd4aa2378
共有 1 個文件被更改,包括 4 次插入9 次删除
  1. 4 9
      ncd/examples/run_process_output.ncdi

+ 4 - 9
ncd/examples/run_process_output.ncdi

@@ -7,21 +7,17 @@ template run_process_output {
     var(@false) succeeded;
     var(@false) succeeded;
     value("") output;
     value("") output;
     
     
-    var(@true) do;
-    backtrack_point() done;
-    If (do) {
-        do->set(@false);
-
+    Do {
         # Start child process.
         # Start child process.
         sys.start_process(command, "r", ["keep_stderr":"true"]) proc;
         sys.start_process(command, "r", ["keep_stderr":"true"]) proc;
         If (proc.is_error) {
         If (proc.is_error) {
-            done->go();
+            _do->break();
         };
         };
         
         
         # Get read pipe handle.
         # Get read pipe handle.
         proc->read_pipe() read_pipe;
         proc->read_pipe() read_pipe;
         If (read_pipe.is_error) {
         If (read_pipe.is_error) {
-            done->go();
+            _do->break();
         };
         };
         
         
         # Read all contents.
         # Read all contents.
@@ -36,11 +32,10 @@ template run_process_output {
         proc->wait() wait;
         proc->wait() wait;
         val_different(wait.exit_status, "0") not_ok;
         val_different(wait.exit_status, "0") not_ok;
         If (not_ok) {
         If (not_ok) {
-            done->go();
+            _do->break();
         };
         };
         
         
         # Assume success.
         # Assume success.
         succeeded->set(@true);
         succeeded->set(@true);
-        done->go();
     };
     };
 }
 }