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

Very weird issue (using "run()" vs. "runAndPrint()") #19

Closed
tanmayb123 opened this issue May 14, 2016 · 6 comments
Closed

Very weird issue (using "run()" vs. "runAndPrint()") #19

tanmayb123 opened this issue May 14, 2016 · 6 comments

Comments

@tanmayb123
Copy link

I'm encountering a very weird issue here:

I'm using SwiftShell2, and when I do this:
let res = run("python", "ngrammine.py", "source.txt", "destination.txt"); print(res)
The app hangs. Completely. Just frozen.

However, when I do this:
runAndPrint("python", "ngrammine.py", "source.txt", "destination.txt")
It prints the result, and stops the app.

Why does the app hang in the former example?

@kareman
Copy link
Owner

kareman commented May 15, 2016

Hmm, could the Python script be exiting without closing its standard output (though I'm pretty sure Python does that automatically)? Currently the “run” function reads the output from the command before it is finished to work around issue #15.

Can you try branch "Issue-19-run-hangs" and see if that fixes the problem? And if it doesn't, would it be possible to send me the Python script so I could try to replicate the problem?

@tanmayb123
Copy link
Author

Sure, I'll try it out in a little bit, and get back to you. Thanks!

For now, though, I've worked-around by running "runAndPrint", then have Python save the output to a text file, and read the text file (though I don't intend for this to be a permanent solution)

@kareman
Copy link
Owner

kareman commented May 15, 2016

How about “runAsync”, does it hang too?

Could you try both

let res = runAsync("python", "ngrammine.py", "source.txt", "destination.txt").stdout.read()

and

let res = try runAsync("python", "ngrammine.py", "source.txt", "destination.txt").finish().stdout.read()

@tanmayb123
Copy link
Author

Hi, sorry, I was very busy for a few days, and am about to be for the next few days as well. However, while trying to install SwiftShell, I get #20?

@kareman
Copy link
Owner

kareman commented May 18, 2016

Are you still having the problem in #20? I can't reproduce it.

@kareman
Copy link
Owner

kareman commented Jun 6, 2016

It's been a while since the last update so I'm closing this issue. Feel free to open it again if the problem is still there.

@kareman kareman closed this as completed Jun 6, 2016
kareman added a commit that referenced this issue Apr 27, 2017
Now I vaguely recall it was there for a reason.

```
$ swift build
Compile Swift Module 'SwiftShell' (9 sources)
swift: /home/buildnode/disk2/workspace/oss-swift-3.1-package-linux-ubuntu-14_04/swift/lib/Sema/CSApply.cpp:5990: swift::Expr *(anonymous namespace)::ExprRewriter::coerceObjectArgumentToType(swift::Expr *, swift::Type, swift::ValueDecl *, swift::AccessSemantics, swift::constraints::ConstraintLocatorBuilder): Assertion `fromType->is<LValueType>() && "Can only convert lvalues to inout"' failed.
#0 0x000000000335ffe8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x335ffe8)
#1 0x0000000003360b86 SignalHandler(int) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x3360b86)
#2 0x00007f239201c330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#3 0x00007f2390a07c37 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x36c37)
#4 0x00007f2390a0b028 abort (/lib/x86_64-linux-gnu/libc.so.6+0x3a028)
#5 0x00007f2390a00bf6 (/lib/x86_64-linux-gnu/libc.so.6+0x2fbf6)
#6 0x00007f2390a00ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#7 0x00000000010a306a (anonymous namespace)::ExprRewriter::coerceObjectArgumentToType(swift::Expr*, swift::Type, swift::ValueDecl*, swift::AccessSemantics, swift::constraints::ConstraintLocatorBuilder) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x10a306a)
#8 0x000000000109b0cc (anonymous namespace)::ExprRewriter::buildMemberRef(swift::Expr*, swift::Type, swift::SourceLoc, swift::ValueDecl*, swift::DeclNameLoc, swift::Type, swift::constraints::ConstraintLocatorBuilder, swift::constraints::ConstraintLocatorBuilder, bool, swift::FunctionRefKind, swift::AccessSemantics, bool) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x109b0cc)
#9 0x00000000010a8c3f swift::ASTVisitor<(anonymous namespace)::ExprRewriter, swift::Expr*, void, void, void, void, void>::visit(swift::Expr*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x10a8c3f)
#10 0x0000000001099314 (anonymous namespace)::ExprRewriter::walkToExprPost(swift::Expr*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x1099314)
#11 0x00000000010b11b1 (anonymous namespace)::ExprWalker::walkToExprPost(swift::Expr*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x10b11b1)
#12 0x000000000128901c (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x128901c)
#13 0x000000000128303b swift::Expr::walk(swift::ASTWalker&) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x128303b)
#14 0x00000000010960f2 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x10960f2)
#15 0x00000000011604ff swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x11604ff)
#16 0x000000000107af20 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x107af20)
#17 0x000000000107b219 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x107b219)
#18 0x000000000107ae4c swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x107ae4c)
#19 0x0000000001079ad5 (anonymous namespace)::StmtChecker::typeCheckBody(swift::BraceStmt*&) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x1079ad5)
#20 0x0000000001078dad swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x1078dad)
#21 0x0000000001078c05 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x1078c05)
#22 0x000000000107981c swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x107981c)
#23 0x000000000108fc08 typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x108fc08)
#24 0x00000000010908a1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x10908a1)
#25 0x0000000000e0fe4a swift::CompilerInstance::performSema() (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0xe0fe4a)
#26 0x0000000000475eed swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x475eed)
#27 0x000000000043bbe4 main (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x43bbe4)
#28 0x00007f23909f2f45 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f45)
#29 0x00000000004395a0 _start (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x4395a0)
Stack dump:
0.	Program arguments: /home/travis/.swiftenv/versions/3.1/usr/bin/swift -frontend -c /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/FileHandle.swift /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/String.swift /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Bash.swift /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Context.swift /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Files.swift /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Command.swift /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/General/Array.swift -primary-file /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Stream/Stream.swift /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Stream/Lazy-split.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -I /home/travis/build/kareman/SwiftShell/.build/debug -enable-testing -g -module-cache-path /home/travis/build/kareman/SwiftShell/.build/debug/ModuleCache -D SWIFT_PACKAGE -emit-module-doc-path /home/travis/build/kareman/SwiftShell/.build/debug/SwiftShell.build/Stream~partial.swiftdoc -Onone -parse-as-library -module-name SwiftShell -emit-module-path /home/travis/build/kareman/SwiftShell/.build/debug/SwiftShell.build/Stream~partial.swiftmodule -emit-dependencies-path /home/travis/build/kareman/SwiftShell/.build/debug/SwiftShell.build/Stream.d -emit-reference-dependencies-path /home/travis/build/kareman/SwiftShell/.build/debug/SwiftShell.build/Stream.swiftdeps -num-threads 8 -o /home/travis/build/kareman/SwiftShell/.build/debug/SwiftShell.build/Stream/Stream.swift.o
1.	While type-checking 'write' at /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Stream/Stream.swift:89:9
2.	While type-checking expression at [/home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Stream/Stream.swift:90:38 - line:90:55] RangeText="target.write(text)"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
```
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