Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use within a swift project #63

Closed
scifiman opened this issue Apr 24, 2018 · 4 comments
Closed

Use within a swift project #63

scifiman opened this issue Apr 24, 2018 · 4 comments

Comments

@scifiman
Copy link

How would I use this within a swift project?
Before your latest update, I setup SwiftShell like a standalone project, built it, then embedded the framework in my Xcode project. After updating SwiftShell, my project is now crashing with a message that it can't find a symbol in the framework.
dyld: Symbol not found: __T010SwiftShell12AsyncCommandC12onCompletionACyACcF
Referenced from: /Users/user/Desktop/myApp.app/Contents/MacOS/myApp
Expected in: /Users/user/Desktop/myApp.app/Contents/MacOS/../Frameworks/SwiftShell.framework/Versions/A/SwiftShell

It's possible I don't have something right with the code, but the only difference was the compiled SwiftShell.
I'm running this:
let var1 = runAsync(bash: myCmd).onCompletion {
command in
}
Grab the output by assigning var1.stdout.read() to a variable.
Then a do, try to call .finish() and catch any errors.

Thanks

@kareman
Copy link
Owner

kareman commented Apr 24, 2018

I created a new macOS app project, imported SwiftShell and the following code ran fine:

let var1 = runAsync(bash: "echo hi").onCompletion {
	 command in self.label.stringValue = command.stdout.read()
}
do {
	try var1.finish()
} catch {
	print(error)
}

Could you try a complete clean build of your project? If that doesn't work, is there a version of your project with this problem that you could share?

@scifiman
Copy link
Author

I was able to fix my issue.
My swiftshell framework was compiled before one of the Xcode updates came through, either 9.3 or 9.3.1 and I needed to recompile the framework after that update.
I am seeing another issue where runAsync doesn't appear to actually be running asynchronously. That is, it causes the GUI to stop responding and I see the spinning pinwheel.
Is that something you want me to open a separate ticket about?

@kareman
Copy link
Owner

kareman commented May 31, 2018

Yes a new ticket would be nice. Also code examples, and could you also check if runAsync is started from the main thread?

@kareman kareman closed this as completed May 31, 2018
@scifiman
Copy link
Author

scifiman commented Jun 1, 2018

Sure. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants