[Saga-devel] saga SVN commit 3370: /trunk/examples/misc/

amerzky at cct.lsu.edu amerzky at cct.lsu.edu
Sat Jan 24 03:04:14 CST 2009


User: amerzky
Date: 2009/01/24 03:04 AM

Added:
 /trunk/examples/misc/
  boost_process.cpp

Log:
 temporary add

File Changes:

Directory: /trunk/examples/misc/
================================

File [added]: boost_process.cpp
Delta lines: +47 -0
===================================================================
--- trunk/examples/misc/boost_process.cpp	2009-01-24 08:18:02 UTC (rev 3369)
+++ trunk/examples/misc/boost_process.cpp	2009-01-24 09:04:04 UTC (rev 3370)
@@ -0,0 +1,47 @@
+
+int main ()
+{
+  try 
+  {
+    boost::process::command_line cl ("/usr/bin/ssh");
+
+    cl.argument ("-o");
+    cl.argument ("StrictHostKeyChecking=no");
+    cl.argument ("-i");
+    cl.argument ("/home/amerzky/.ec2_keys/saga.aws_private_ec2.pem");
+    cl.argument ("root at ec2-174-129-180-113.compute-1.amazonaws.com");
+    cl.argument ("/tmp/saga-ec2-image-pre");
+
+    boost::process::launcher l;
+
+    // std::map <std::string, std::string> :: iterator it;
+
+    // for ( it = env_.begin (); it != env_.end (); it++ )
+    // {
+    //   l.set_environment ( (*it).first, (*it).second );
+    // }
+
+    boost::process::child c       = l.start (cl);
+    boost::process::status status = c.wait ();
+
+    if ( ! status.exited () || status.exit_status () )
+    {
+      std::cout << "exit status != 0\n";
+    }
+    else
+    {
+      std::cout << "exit status == 0\n";
+    }
+  }
+  catch ( const boost::process::not_found_error <std::string> & e )
+  {
+    std::cerr << "exe not found\n";
+  }
+  catch ( const boost::process::system_error & e )
+  {
+    std::cerr << "exe failed\n";
+  }
+
+  return 0;
+}
+



More information about the saga-devel mailing list