command line command from pharo image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

command line command from pharo image

Torsten Bergmann
Sean wrote:
>Sabine Knöfel wrote
>> Which is the Class and the message in NB then?
>not sure which class and on holidays with no computer :) the Mac message is
>#run: which wraps system in libc, and the Windows version, which I haven't
>committed yet is #winExec:show which wraps WinExec. HTH

Hi Sabine, Sean,

PLEASE NO WinExec, this is long deprecated and only for 16bit compatibility
see  http://msdn.microsoft.com/en-us/library/windows/desktop/ms687393(v=vs.85).aspx

As you see on MSDN CreateProcess() API should be used.


If you are on Pharo 3.0 look at my "OS-Windows" project loadable from the config
browser.

You will find the class WinProcess with methods like #createProcess: (nonblocking)
and #createAndWaitForProcess: (blocking) there. It already uses CreateProcess API.

With the package you can for instance run the command processor:

   WinProcess createAndWaitForProcess: 'cmd.exe'

You also have access to the environment like

   WinEnvironment getEnvironmentVariable: 'PATH'.
 
See the documentation at http://smalltalkhub.com/#!/~OS/OS-Windows for more examples.

Bye
T.

Reply | Threaded
Open this post in threaded view
|

Re: command line command from pharo image

Sean P. DeNigris
Administrator
Torsten Bergmann wrote
PLEASE NO WinExec, this is long deprecated
Ha ha, yes Torsten. I couldn't get create process to work so I cheated ;) it works and takes only two parameters. This is exciting that you've already wrapped that stuff! I had no idea, there's probably so many great things out there. We could really use a PharoMap... I will take a look at your project. Maybe something could be integrated with NB core. Executing an external command on all the common platforms is a good demonstration of NB
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: command line command from pharo image

Sabine Manaa
Hi Torsten, Sean,

http://smalltalkhub.com/#!/~OS/OS-Windows
looks great.

I have not found a solution yet to send a call to OS from pharo (I develop with mac since a few weeks now and deployment is currently windows) and I am thinking about moving to Pharo 3.0 for further development due to the OS call problem.

Do you think, Pharo 3.0 is ready to use it for development or should I wait and look for another solution?

Regards
Sabine
Reply | Threaded
Open this post in threaded view
|

Re: command line command from pharo image

Nicolai Hess
2013/12/6 Sabine Knöfel <[hidden email]>
Hi Torsten, Sean,

http://smalltalkhub.com/#!/~OS/OS-Windows
looks great.

I have not found a solution yet to send a call to OS from pharo (I develop
with mac since a few weeks now and deployment is currently windows) and I am
thinking about moving to Pharo 3.0 for further development due to the OS
call problem.

Do you think, Pharo 3.0 is ready to use it for development or should I wait
and look for another solution?

Regards
Sabine



--
View this message in context: http://forum.world.st/command-line-command-from-pharo-image-tp4727751p4727902.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Hi,

Pharo2 doesn't work for you?
I tried both Pharo2 and 3.

In
Pharo2.0
Latest update: #20593
with latest stable OSProcess loaded form ConfigurationManager
I can execute
OSProcess command:'notepad.exe'

without problems.

But only as long as the command can be found otherwise  ExternalWindowsOSProcess tries to write
that error message to ExternalWindowsOSProcess>>initialStdErr.
And this does not work. (And it doesn't work in Pharo3)
(bug StdErr not working on Windows https://pharo.fogbugz.com/default.asp?11615)


Reply | Threaded
Open this post in threaded view
|

Re: command line command from pharo image

Sabine Manaa
Nicolai,

thank you very much for clarification. Indeed: there was a silly error in my command when copying it from Mac to windows (path) and the notepad test worked. So the problem is solved for me. I can call from Mac OS and from Windows and I am happy:-)

Regards
Sabine


On Fri, Dec 6, 2013 at 1:43 PM, Nicolai Hess [via Smalltalk] <[hidden email]> wrote:
2013/12/6 Sabine Knöfel <[hidden email]>
Hi Torsten, Sean,

http://smalltalkhub.com/#!/~OS/OS-Windows
looks great.

I have not found a solution yet to send a call to OS from pharo (I develop
with mac since a few weeks now and deployment is currently windows) and I am
thinking about moving to Pharo 3.0 for further development due to the OS
call problem.

Do you think, Pharo 3.0 is ready to use it for development or should I wait
and look for another solution?

Regards
Sabine



--
View this message in context: http://forum.world.st/command-line-command-from-pharo-image-tp4727751p4727902.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Hi,

Pharo2 doesn't work for you?
I tried both Pharo2 and 3.

In
Pharo2.0
Latest update: #20593
with latest stable OSProcess loaded form ConfigurationManager
I can execute
OSProcess command:'notepad.exe'

without problems.

But only as long as the command can be found otherwise  ExternalWindowsOSProcess tries to write
that error message to ExternalWindowsOSProcess>>initialStdErr.
And this does not work. (And it doesn't work in Pharo3)
(bug StdErr not working on Windows https://pharo.fogbugz.com/default.asp?11615)





If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/command-line-command-from-pharo-image-tp4727751p4727984.html
To start a new topic under Pharo Smalltalk Users, email [hidden email]
To unsubscribe from command line command from pharo image, click here.
NAML