Sign up

Run command inside vte terminal

Hello,
how can I run command or bash inside Vte Terminal?
I tried this:

term.spawnSync(PtyFlags.DEFAULT, "/home/user", ["/bin/bash"], new string[0],
                SpawnFlags.DO_NOT_REAP_CHILD, &ud, &v, null, null);

whrere ud is extern (C) void ud(void* userData)
and v is public void v(void* userData) inside a class, but I got this error:

function 
    spawnSync (..., extern (C) void function(void* userData),
      void*, out int, Cancellable)
is not callable using argument types
   (..., extern (C) void function(void* userData) pure nothrow @nogc @safe, void delegate(void* userData), typeof(null), typeof(null))

Thanks for your help.

Re: Run command inside vte terminal

On 29-08-17 10:50, Velitar wrote:

Hello,
how can I run command or bash inside Vte Terminal?
I tried this:

term.spawnSync(PtyFlags.DEFAULT, "/home/user", ["/bin/bash"], new string[0],
                 SpawnFlags.DO_NOT_REAP_CHILD, &ud, &v, null, null);

whrere ud is extern (C) void ud(void* userData)
and v is public void v(void* userData) inside a class, but I got this error:

function
     spawnSync (..., extern (C) void function(void* userData),
       void*, out int, Cancellable)
is not callable using argument types
    (..., extern (C) void function(void* userData) pure nothrow @nogc @safe, void delegate(void* userData), typeof(null), typeof(null))

Thanks for your help.

Where you are passing &v to spawnSync expects a void to some data it <br>will pass along to the childSetup function, if you want to pass the <br>delegate as the data you might be able to cast it to void.

Re: Run command inside vte terminal

On Tue, 29 Aug 2017 16:38:05 +0200, Mike Wey wrote:

Where you are passing &v to spawnSync expects a void to some data it <br>will pass along to the childSetup function, if you want to pass the <br>delegate as the data you might be able to cast it to void.

I tried to run a custom command in the Terminal Widget.

output.spawnAsync(
                      VtePtyFlags.DEFAULT,   // VTE FLags
                      "/tmp/",               // Working Directory
                      array(["/bin/bash"]),  // command and args
                      array([""]),           // Env
                      GSpawnFlags.DEFAULT,   // Spawn flags
                      null,                  // Child setup function
                      null,                  // args for the above function
                      null,                  // child setup destroy function
                      30 * 1000,             // Timeout
                      signal,                // gtk.Cancellable
                      null,                  // Teminal spawn callback
                      null                   // args for above function
                      );

I'm getting segfault. what am I doing wrong?

Re: Run command inside vte terminal

On 02-11-17 16:38, aelango97 wrote:

On Tue, 29 Aug 2017 16:38:05 +0200, Mike Wey wrote:

Where you are passing &v to spawnSync expects a void to some data it<br>will pass along to the childSetup function, if you want to pass the<br>delegate as the data you might be able to cast it to void.

I tried to run a custom command in the Terminal Widget.

output.spawnAsync(
                       VtePtyFlags.DEFAULT,   // VTE FLags
                       "/tmp/",               // Working Directory
                       array(["/bin/bash"]),  // command and args
                       array([""]),           // Env
                       GSpawnFlags.DEFAULT,   // Spawn flags
                       null,                  // Child setup function
                       null,                  // args for the above function
                       null,                  // child setup destroy function
                       30 * 1000,             // Timeout
                       signal,                // gtk.Cancellable
                       null,                  // Teminal spawn callback
                       null                   // args for above function
                       );

I'm getting segfault. what am I doing wrong?

I don't see anything wrong at first sight, do you have a more complete
example i could try?