[swift-users] NSTask's terminate() is not yet implemented on Linux

Will Field-Thompson will.a.ft at gmail.com
Tue Jan 24 00:45:14 CST 2017


>From the source
<https://github.com/apple/swift-corelibs-foundation/blob/swift-3.1-branch/Foundation/Process.swift#L422>
and
from status document
<https://github.com/apple/swift-corelibs-foundation/blob/swift-3.1-branch/Docs/Status.md#entities>
(search
"terminate()"), it seems like the answer is that terminate has not yet been
implemented.

Take this with a grain of salt since I haven't tried it out myself, but it
might look something like the following:

import Glibc

kill(task.processIdentifier, SIGTERM)

Where task is your Task (soon to be renamed Process). This isn't exactly
the same as terminate() which I think does some error checking but it gives
you a start.

Good luck!

On Tue, Jan 24, 2017 at 12:16 AM Mr Bee via swift-users <
swift-users at swift.org> wrote:

> Hi,
>
> I can't use terminate() function of (NS)Task on Linux because it's not yet
> implemented. I'm using Swift v.3.0.0 on 64-bit Ubuntu 14.04 LTS. Here's the
> error message upon calling the function:
>
>
> fatal error: terminate() is not yet implemented: file Foundation/NSTask.swift, line 407
> Illegal instruction
>
> So, is there a way to terminate a process that is launched by (NS)Task on
> Linux? Or has it already implemented on Swift 3.0.2?
>
> Thank you.
>
> Regards,
>
>
> –Mr Bee
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170124/a6162a49/attachment.html>


More information about the swift-users mailing list