Coder Social home page Coder Social logo

bsh-rs's People

Contributors

rgardner avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bsh-rs's Issues

fails to compile in 1.53.0

cargo run fails with:

   Compiling rustyline v3.0.0
error[E0283]: type annotations needed
   --> /home/gback/.cargo/registry/src/github.com-1ecc6299db9ec823/rustyline-3.0.0/src/lib.rs:655:43
    |
655 |             editor.add_history_entry(line.as_ref());
    |                                      -----^^^^^^--
    |                                      |    |
    |                                      |    cannot infer type for type parameter `T` declared on the trait `AsRef`
    |                                      this method call resolves to `&T`
    |
    = note: cannot satisfy `String: AsRef<_>`
help: use the fully qualified path for the potential candidates
    |
655 |             editor.add_history_entry(<String as AsRef<OsStr>>::as_ref(line));
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
655 |             editor.add_history_entry(<String as AsRef<Path>>::as_ref(line));
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
655 |             editor.add_history_entry(<String as AsRef<[u8]>>::as_ref(line));
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
655 |             editor.add_history_entry(<String as AsRef<str>>::as_ref(line));
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0283]: type annotations needed
   --> /home/gback/.cargo/registry/src/github.com-1ecc6299db9ec823/rustyline-3.0.0/src/history.rs:151:28
    |
151 |             self.add(line?.as_ref()); // TODO truncate to MAX_LINE
    |                      ------^^^^^^--
    |                      |     |
    |                      |     cannot infer type for type parameter `T` declared on the trait `AsRef`
    |                      this method call resolves to `&T`
    |
    = note: cannot satisfy `String: AsRef<_>`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0283`.
error: could not compile `rustyline`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

Implement more builtins

  • history: prints last commands
  • history -c clears the history
  • history [n] display last N entries
  • help lists all builtins and their signatures
  • help [command] outputs help for a specific command
  • exit should alert the user if background processes exist and fail to exit
  • kill [pid] should a kill process with PID pid

Extend bsh syntax

To make it easier to test programs with more complicated arguments, these should be supported:

  • quotes (single or double)
  • semicolons (for multiple jobs on the same line)

Fix background prompt issue

sleep 1 & causes the shell to exit immediately because Readline returns errno 5 (I/O error occurred), I think because stdin is in a bad state. Per bash source, a background command with default stdin should be redirected to /dev/null. But, when I made this change, stdin was still in a bad state - maybe terminal control issues?

Add windows support

  • research major differences between unix and Windows shells (e.g. job management)
  • get MVP working on Windows (e.g. no job management, put nix usage behind #[cfg(unix)])
  • add Windows to CI
  • get parity between unix and windows
    • get all integration tests passing
    • implement create_pipe in execute_command

Optional Features

  • history -s n set size of history buffer
  • fg and bg
  • printenv and setenv
  • properly piping commands
  • richer redirection, e.g. python test.py 2>out

Implement history expansion

  • !n - repeat command numbered n in the list of commands (starting at 1)
  • !-n - repeat last nth command (starting at -1)
  • !string - searches through history for first item that matches the string (via contains)

Sometimes the test suite hangs

I first hit this on Travis when I was using set -e and set +e in the install script. I don't understand why removing those lines fixed the error cargo was returning though.

Now I'm hitting this when experiment with cov:

$ cargo +nightly cov clean && cargo +nightly cov test && cargo +nightly cov report --open
...
running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running debug/deps/integration_tests-40f703f134d886e1

running 7 tests
test test_exit_normal_large_negative ... test test_exit_normal_large_negative has been running for over 60 seconds
test test_command_not_found ... test test_command_not_found has been running for over 60 seconds
test test_simple_redirects ... test test_simple_redirects has been running for over 60 seconds
test test_stderr_redirect ... test test_stderr_redirect has been running for over 60 seconds
test test_simple_pipeline ... test test_simple_pipeline has been running for over 60 seconds
test test_simple_echo ... test test_simple_echo has been running for over 60 seconds
test test_syntax_error ... test test_syntax_error has been running for over 60 seconds



test test_simple_pipeline ... ok
test test_syntax_error ... ok
test test_simple_redirects ... ok
test test_command_not_found ... ok
test test_stderr_redirect ... ok
test test_simple_echo ... ok
test test_exit_normal_large_negative ... ok
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.