Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shell.Exec in FAKE

Tags:

f#

f#-fake

I found this function Exec here http://fsharp.github.io/FAKE/apidocs/fake-processhelper-shell.html.

Target "UpdateTools" (fun _ ->
   Exec "cmd"
)

But I keep getting this error, when I try to run it: "The value or constructor 'Exec' is not defined".

I'm new to FAKE and have not used F#, so forgive me if this should be obvious.

Can someone tell me why this api is not accessible like that?

like image 607
asgerhallas Avatar asked Dec 08 '22 08:12

asgerhallas


1 Answers

The documentation is documenting class Shell. That means, you need to call it like:

Target "UpdateTools" (fun _ ->
   ignore(Shell.Exec "cmd")
)

or, if you need to work with the error code further:

Target "UpdateTools" (fun _ ->
    let errorCode = Shell.Exec "cmd"
    //do something with the error code
    ()
)

Hope it is a bit clearer now.

like image 199
Tomas Pastircak Avatar answered Dec 18 '22 20:12

Tomas Pastircak