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

Bad error for with-open-file #1284

Closed
cgay opened this issue Dec 14, 2019 · 1 comment
Closed

Bad error for with-open-file #1284

cgay opened this issue Dec 14, 2019 · 1 comment

Comments

@cgay
Copy link
Member

cgay commented Dec 14, 2019

Given this code:

define function main
    (name :: <string>, arguments :: <vector>)
  with-open-file(stream = "/non-such-directory/foo",
                 direction: #"output", if-exists: #"overwrite")
    format(stream, "Hello, world!\n");
  end;
  exit-application(0);
end function main;

main(application-name(), application-arguments());

This is the output:

Condition <stream-position-error> for stream {<byte-char-file-stream>}
Backtrace:
  invoke-debugger:internal:dylan##1 + 0x29
  default-handler:dylan:dylan##1 + 0x15
  default-last-handler:common-dylan-internals:common-dylan##0 + 0x2f5
  error:dylan:dylan##0 + 0x26
  stream-position-setter:streams-protocol:common-dylan#io#4 + 0x189
  initialize:dylan:dylan#io#5 + 0x392
  <byte-char-file-stream> constructor:streams-internals:io##0 + 0x19a
  make:dylan:dylan#io#3 + 0x54
  open-file-stream:streams-protocol:common-dylan#system#1 + 0x2a
  main:abc:abc + 0x5f

I would expect something like a <file-does-not-exist> error, and I would expect to see the name of the non-existent file in the error message. (Note that this happens when the directory is /, so I suppose it's not a problem with the directory not existing.)

This could be a bug in the way the error is displayed on program exit, or a problem with the type of error that's signalled for with-open-file when the (output) file doesn't exist, or both.

@housel
Copy link
Member

housel commented Dec 16, 2019

Should be fixed as of 5b1618b.

@housel housel closed this as completed Dec 16, 2019
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