shhyou / ypsilon-fork

Automatically exported from code.google.com/p/ypsilon
Other
0 stars 0 forks source link

FEATURE REQUEST: system command #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
(system <command-string>) -> exit-status

E.g.:

> (system "date")
Mon Jul 14 17:12:29 PDT 2008
0
> 

In particular, this would let me define process-terminate! as:

 (define (process-terminate! pid)
  (system (string-append "kill " (number->string pid)))

Thanks much!
-KenD
==========================
ik_system(ikptr str){
  if(tagof(str) == bytevector_tag){
    int r = system((char*)(long)(str+off_bytevector_data));
    if(r >= 0) {  
      return fix(r);
    } else {
      return ik_errno_to_code();
    }
  } else {
    fprintf(stderr, "bug in ik_system\n");
    exit(-1);
  }
}

Original issue reported on code.google.com by Ken.Dic...@whidbey.com on 15 Jul 2008 at 12:16

GoogleCodeExporter commented 9 years ago
I will implement it. Thank you!

Original comment by y.fujita...@gmail.com on 15 Jul 2008 at 1:20

GoogleCodeExporter commented 9 years ago
I have added 'system' procedure and trunk directory is updated. Please try. 
Thank you!

> (system "ps -l")
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
0 S  1000 22281 22280  0  80   0 - 13329 -      pts/1    00:00:00 ypsilon
0 S  1000 22299 22281  0  80   0 -   443 -      pts/1    00:00:00 sh
0 R  1000 22300 22299  0  80   0 -   673 -      pts/1    00:00:00 ps
0
> 

Original comment by y.fujita...@gmail.com on 17 Jul 2008 at 1:08

GoogleCodeExporter commented 9 years ago
SYSTEM works great.

Thank you!
-KenD

Original comment by Ken.Dic...@whidbey.com on 17 Jul 2008 at 3:25