diff --git a/HISTORY.rst b/HISTORY.rst
index 796bf32..608aaa0 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -3,6 +3,14 @@ History
 =======
 
 
+0.9.4 (2017-04-20)
+------------------
+
+* Fixed major bug where activate/deactivate scripts were not being generated (`#49`_).
+
+.. _`#49`: https://github.com/ESSS/conda-devenv/issues/49
+
+
 0.9.3 (2017-04-10)
 ------------------
 
diff --git a/conda_devenv/devenv.py b/conda_devenv/devenv.py
index 66b6bf9..16d174c 100644
--- a/conda_devenv/devenv.py
+++ b/conda_devenv/devenv.py
@@ -269,7 +269,10 @@ def __call_conda_env_update(args, output_filename):
     try:
         del command[0]
         sys.argv = command
-        return _call_conda()
+        try:
+            return _call_conda()
+        except SystemExit as e:
+            return e.code
     finally:
         sys.argv = old_argv
 

0.9.3 broken: no longer generates activate/deactivate scripts
#46 introduced a bug: `conda-devenv` now calls `conda_env.main` directly, which probably calls `sys.exit()`, which skips activate/deactivate scripts generation.
diff --git a/tests/test_main.py b/tests/test_main.py
index 3fd56e2..4f0db10 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -17,19 +17,20 @@ def patch_conda_calls(mocker):
     mocker.patch.object(devenv, 'write_activate_deactivate_scripts', autospec=True)
 
 
-@pytest.mark.parametrize('input_name, expected_output_name', [
-    ('environment.devenv.yml', 'environment.yml'),
-    ('environment.yml', 'environment.yml'),
+@pytest.mark.parametrize('input_name, write_scripts_call_count', [
+    ('environment.devenv.yml', 1),
+    ('environment.yml', 0),
 ])
 @pytest.mark.usefixtures('patch_conda_calls')
-def test_handle_input_file(tmpdir, input_name, expected_output_name):
+def test_handle_input_file(tmpdir, input_name, write_scripts_call_count):
     """
     Test how conda-devenv handles input files: devenv.yml and pure .yml files.
     """
     argv = []
     def call_conda_mock():
         argv[:] = sys.argv[:]
-        return 0
+        # simulate that we actually called conda's main, which calls sys.exit()
+        sys.exit(0)
 
     devenv._call_conda.side_effect = call_conda_mock
     
@@ -41,8 +42,9 @@ def test_handle_input_file(tmpdir, input_name, expected_output_name):
     '''))
     assert devenv.main(['--file', str(filename), '--quiet']) == 0
     assert devenv._call_conda.call_count == 1
-    cmdline = 'env update --file {} --prune --quiet'.format(tmpdir.join(expected_output_name))
+    cmdline = 'env update --file {} --prune --quiet'.format(tmpdir.join('environment.yml'))
     assert argv == cmdline.split()
+    assert devenv.write_activate_deactivate_scripts.call_count == write_scripts_call_count
 
 
 @pytest.mark.parametrize('input_name', ['environment.devenv.yml', 'environment.yml'])

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-datadir
3.6
requirements_dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
attrs==22.2.0
Babel==2.11.0
bump2version==1.0.1
bumpversion==0.6.0
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
-e git+https://github.com/ESSS/conda-devenv.git@f58819151109dfc68edbbf4a58cd56853ff1c414#egg=conda_devenv
coverage==6.2
cryptography==40.0.2
distlib==0.3.9
docutils==0.17.1
filelock==3.4.1
flake8==5.0.4
idna==3.10
imagesize==1.4.1
importlib-metadata==4.2.0
importlib-resources==5.4.0
iniconfig==1.1.1
Jinja2==3.0.3
MarkupSafe==2.0.1
mccabe==0.7.0
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pycparser==2.21
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytest-datadir==1.4.1
pytest-mock==3.6.1
pytz==2025.2
PyYAML==6.0.1
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==4.3.2
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
toml==0.10.2
tomli==1.2.3
tox==3.28.0
typing_extensions==4.1.1
urllib3==1.26.20
virtualenv==20.16.2
watchdog==2.3.1
zipp==3.6.0

name: conda-devenv
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - attrs==22.2.0
      - babel==2.11.0
      - bump2version==1.0.1
      - bumpversion==0.6.0
      - cffi==1.15.1
      - charset-normalizer==2.0.12
      - coverage==6.2
      - cryptography==40.0.2
      - distlib==0.3.9
      - docutils==0.17.1
      - filelock==3.4.1
      - flake8==5.0.4
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.2.0
      - importlib-resources==5.4.0
      - iniconfig==1.1.1
      - jinja2==3.0.3
      - markupsafe==2.0.1
      - mccabe==0.7.0
      - packaging==21.3
      - platformdirs==2.4.0
      - pluggy==1.0.0
      - py==1.11.0
      - pycodestyle==2.9.1
      - pycparser==2.21
      - pyflakes==2.5.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-datadir==1.4.1
      - pytest-mock==3.6.1
      - pytz==2025.2
      - pyyaml==6.0.1
      - requests==2.27.1
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==4.3.2
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - toml==0.10.2
      - tomli==1.2.3
      - tox==3.28.0
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - virtualenv==20.16.2
      - watchdog==2.3.1
      - zipp==3.6.0
prefix: /opt/conda/envs/conda-devenv

tests/test_main.py::test_handle_input_file[environment.yml-0]
tests/test_main.py::test_handle_input_file[environment.devenv.yml-1] tests/test_main.py::test_print[environment.devenv.yml] tests/test_main.py::test_print_full
tests/test_main.py::test_print[environment.yml]
HISTORY.rst conda_devenv/devenv.py
HISTORY.rst conda_devenv/devenv.py