Re: execute bash?

2016-04-10 Thread Puming via Digitalmars-d-learn
On Sunday, 10 April 2016 at 10:43:48 UTC, wobbles wrote: This would be cool. I'll have a think about how to go about it! Looking forward to your updates! :P

Re: execute bash?

2016-04-10 Thread Puming via Digitalmars-d-learn
On Sunday, 10 April 2016 at 02:59:41 UTC, Adam D. Ruppe wrote: On Sunday, 10 April 2016 at 00:47:28 UTC, Puming wrote: 3. when hiting 'vim a.file' on the command, things go messy. Have you got these interactive commands work in dexpect? It is surely capturing exactly what vim sends to a

Re: execute bash?

2016-04-10 Thread wobbles via Digitalmars-d-learn
On Sunday, 10 April 2016 at 00:47:28 UTC, Puming wrote: On Saturday, 9 April 2016 at 08:56:17 UTC, wobbles wrote: On Friday, 8 April 2016 at 23:06:06 UTC, Puming wrote: On Friday, 8 April 2016 at 18:23:32 UTC, wobbles wrote: On Friday, 8 April 2016 at 16:07:13 UTC, Adam D. Ruppe wrote: On

Re: execute bash?

2016-04-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 10 April 2016 at 00:47:28 UTC, Puming wrote: 3. when hiting 'vim a.file' on the command, things go messy. Have you got these interactive commands work in dexpect? It is surely capturing exactly what vim sends to a terminal, which is primarily a series of control sequences to draw

Re: execute bash?

2016-04-09 Thread Puming via Digitalmars-d-learn
On Saturday, 9 April 2016 at 08:56:17 UTC, wobbles wrote: On Friday, 8 April 2016 at 23:06:06 UTC, Puming wrote: On Friday, 8 April 2016 at 18:23:32 UTC, wobbles wrote: On Friday, 8 April 2016 at 16:07:13 UTC, Adam D. Ruppe wrote: On Friday, 8 April 2016 at 15:20:09 UTC, Puming wrote: I tried

Re: execute bash?

2016-04-09 Thread wobbles via Digitalmars-d-learn
On Friday, 8 April 2016 at 23:06:06 UTC, Puming wrote: On Friday, 8 April 2016 at 18:23:32 UTC, wobbles wrote: On Friday, 8 April 2016 at 16:07:13 UTC, Adam D. Ruppe wrote: On Friday, 8 April 2016 at 15:20:09 UTC, Puming wrote: I tried with signal, but didn't catch SIGTTOU, it seems that

Re: execute bash?

2016-04-08 Thread Puming via Digitalmars-d-learn
On Friday, 8 April 2016 at 16:16:27 UTC, Adam D. Ruppe wrote: On Friday, 8 April 2016 at 15:31:13 UTC, Puming wrote: The D version behavior is strange. Are you still calling bash? Cuz that is going to complicate things a lot because bash does its own signal handling too and could be

Re: execute bash?

2016-04-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 8 April 2016 at 23:03:15 UTC, Puming wrote: Do you have this pseudo terminal thing in terminal.d? No, terminal.d is for your program to interact with the user's terminal rather than program to program stuff. My terminal emulator

Re: execute bash?

2016-04-08 Thread Puming via Digitalmars-d-learn
On Friday, 8 April 2016 at 18:23:32 UTC, wobbles wrote: On Friday, 8 April 2016 at 16:07:13 UTC, Adam D. Ruppe wrote: On Friday, 8 April 2016 at 15:20:09 UTC, Puming wrote: I tried with signal, but didn't catch SIGTTOU, it seems that spawnProcess with `bash -i -c` will signal with SIGTTIN.

Re: execute bash?

2016-04-08 Thread Puming via Digitalmars-d-learn
On Friday, 8 April 2016 at 16:08:02 UTC, Adam D. Ruppe wrote: On Friday, 8 April 2016 at 14:09:16 UTC, Puming wrote: I just found that you have terminal.d in arsd repo, are you writing a repl with it? I'm hoping I might be able to use it. I have done it before. terminal.d has a getline

Re: execute bash?

2016-04-08 Thread Puming via Digitalmars-d-learn
On Friday, 8 April 2016 at 16:07:13 UTC, Adam D. Ruppe wrote: On Friday, 8 April 2016 at 15:20:09 UTC, Puming wrote: I tried with signal, but didn't catch SIGTTOU, it seems that spawnProcess with `bash -i -c` will signal with SIGTTIN. Oh, surely because it wants to be interactive and is thus

Re: execute bash?

2016-04-08 Thread wobbles via Digitalmars-d-learn
On Friday, 8 April 2016 at 16:07:13 UTC, Adam D. Ruppe wrote: On Friday, 8 April 2016 at 15:20:09 UTC, Puming wrote: I tried with signal, but didn't catch SIGTTOU, it seems that spawnProcess with `bash -i -c` will signal with SIGTTIN. Oh, surely because it wants to be interactive and is thus

Re: execute bash?

2016-04-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 8 April 2016 at 15:31:13 UTC, Puming wrote: The D version behavior is strange. Are you still calling bash? Cuz that is going to complicate things a lot because bash does its own signal handling too and could be intercepting it. When Using while with readln, after hitting Ctrl-C,

Re: execute bash?

2016-04-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 8 April 2016 at 14:09:16 UTC, Puming wrote: I just found that you have terminal.d in arsd repo, are you writing a repl with it? I'm hoping I might be able to use it. I have done it before. terminal.d has a getline function and writeln functions you could loop over. Its getline has

Re: execute bash?

2016-04-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 8 April 2016 at 15:20:09 UTC, Puming wrote: I tried with signal, but didn't catch SIGTTOU, it seems that spawnProcess with `bash -i -c` will signal with SIGTTIN. Oh, surely because it wants to be interactive and is thus waiting for user input from the terminal.. You might need to

Re: execute bash?

2016-04-08 Thread Puming via Digitalmars-d-learn
On Friday, 8 April 2016 at 13:25:37 UTC, Adam D. Ruppe wrote: On Friday, 8 April 2016 at 13:23:10 UTC, Adam D. Ruppe wrote: Odds are it is that there's terminal output for the background process NOT a character btw, just any output, then the OS puts you on hold so it can do its thing. To

Re: execute bash?

2016-04-08 Thread Puming via Digitalmars-d-learn
On Friday, 8 April 2016 at 13:25:37 UTC, Adam D. Ruppe wrote: On Friday, 8 April 2016 at 13:23:10 UTC, Adam D. Ruppe wrote: Odds are it is that there's terminal output for the background process NOT a character btw, just any output, then the OS puts you on hold so it can do its thing. To

Re: execute bash?

2016-04-08 Thread Puming via Digitalmars-d-learn
On Friday, 8 April 2016 at 13:23:10 UTC, Adam D. Ruppe wrote: On Friday, 8 April 2016 at 10:08:07 UTC, Puming wrote: but with each command loop, the program is stopped (equal to Ctrl-Z). Your program is stopped, right? Odds are it is that there's terminal output for the background process,

Re: execute bash?

2016-04-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 8 April 2016 at 13:23:10 UTC, Adam D. Ruppe wrote: Odds are it is that there's terminal output for the background process NOT a character btw, just any output, then the OS puts you on hold so it can do its thing. To catch a signal, it is just like in C

Re: execute bash?

2016-04-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 8 April 2016 at 10:08:07 UTC, Puming wrote: but with each command loop, the program is stopped (equal to Ctrl-Z). Your program is stopped, right? Odds are it is that there's terminal output for the background process, which sends your program a signal which, by default, stops it.

execute bash?

2016-04-08 Thread Puming via Digitalmars-d-learn
Hi, I'd like to write an interactive commmand line tool for my commands, and that also support bash commands. My first thinking is 'why not just execute those bash commands with bash'? But it turns out to have some problem. When I use executeShell, I found that .bashrc is not loaded so