patch for ScriptHappy plugin

From: Kenneth J.Davis (jeremyd@computer.org)
Date: Sun Mar 17 2002 - 06:19:44 EST

  • Next message: birger.langkjer@worldonline.dk: "Danish strings"

    Hi all,

    The attached patch (diff against cvs version) fixes two trivial bugs
    in ScriptHappy. The remaining patch is a hopefully decent basis for
    the Win32 version of the plugin. It appears to work for me under
    Windows 2000 (also a quick test done on Windows 95 OSR2)

    The Win32 version will only retrieve output if the program being
    spawned actually writes to StdOut, many programs on Windows do not
    meet this criteria. Depending on the program, AbiWord will appear
    locked up until the spawned program terminates (while Abi's blocked
    waiting on data to be read); some GUI programs can be spawned this
    way and AbiWord will continue along, others AbiWord will freeze
    until the spawned GUI program terminates (eg Write vs Winzip).
    I believe many console programs will work fine (not DOS ones though,
    I had mistaken this earlier, I was running a dual Win/DOS exe). The
    spawned application should not need any input from the user via stdin. I
    think the unix version of the plugin also has this limit, although
    I don't believe it would be too hard to support sending data to
    the spawned program's stdin, I have no idea where to get that data
    from. The only major thing I can see (and I could easily be overlooking
    some) is that popen invokes %shell% /c 'command' whereas I currently
    just invoke 'command' so only *.com, *.exe, and *.bat are supported.
    I think, but not sure without testing something like this will work:
    ..
    if ((cmdshell=getenv("COMSPEC") != NULL)
      command = cmdshell + " /C " + command;
    else
      if (OS == NT)
         command = "cmd.exe /C " + command;
      else // OS == 9x
         command = "command.com /C " + command;
    ..

    Anyway its here to play with (binary can be gotten from darklogic site).
    If anyone knows of a better way to do this, please let me know, I
    really didn't have a clue when I started so this is based on a quick
    search of the Win32 api docs. [I did 1st try _popen and it didn't
    seem to work, perhaps I missed something there.] Otherwise please
    consider committing some form of it.

    Thanks,
    Jeremy Davis
    jeremyd@computer.org





    This archive was generated by hypermail 2.1.4 : Sun Mar 17 2002 - 06:58:13 EST