Hi
Can we call Unix commands through peoplecode?

Thanks

Thanks for posting your question!

Exec is a cross-platform function that executes an external program on either UNIX or Windows.

This function has two parameter conventions in order to maintain upward compatibility with existing programs.

Note. All PeopleCode is executed on the application server. So if you’re calling an interactive application, you receive an error. There shouldn’t be any application interaction on the application server console.

The function can make either a synchronous or asynchronous call. Synchronous execution acts as a “modal” function, suspending the PeopleSoft application until the called executable completes. This is appropriate if you want to force the user (or the PeopleCode program) to wait for the function to complete its work before continuing processing. Asynchronous processing, which is the default, launches the executable and immediately returns control to the calling PeopleSoft application.

If Exec is unable to execute the external program, the PeopleCode program terminates with a fatal error. You may want to try to catch these exceptions by enclosing such statements in a try-catch statement (from the Exception Class).

Example:

&ExitCode = Exec(“touch test.txt”, %Exec_Synchronous + %FilePath_Absolute);

Please refer to PeopleBooks for further details.

Thanks

Nitin Pai

Posted by Nitin Pai
Comments (0)
November 20th, 2008

Comments (0)