https://henrikwarne.com/2026/01/31/in-praise-of-dry-run/ Henrik Warne's blog Thoughts on programming... Skip to content * Home * About [cropped-desk1] - Lessons From 9 More Years of Tricky Bugs In Praise of -dry-run Posted on January 31, 2026 | 4 Comments For the last few months, I have been developing a new reporting application. Early on, I decided to add a -dry-run option to the run command. This turned out to be quite useful - I have used it many times a day while developing and testing the application. [snow] Background The application will generate a set of reports every weekday. It has a loop that checks periodically if it is time to generate new reports. If so, it will read data from a database, apply some logic to create the reports, zip the reports, upload them to an sftp server, check for error responses on the sftp server, parse the error responses, and send out notification mails. The files (the generated reports, and the downloaded feedback files) are moved to different directories depending on the step in the process. A simple and straightforward application. Early in the development process, when testing the incomplete application, I remembered that Subversion (the version control system after CVS, before Git) had a -dry-run option. Other linux commands have this option too. If a command is run with the argument -dry-run, the output will print what will happen when the command is run, but no changes will be made. This lets the user see what will happen if the command is run without the -dry-run argument. I remembered how helpful that was, so I decided to add it to my command as well. When I run the command with -dry-run, it prints out the steps that will be taken in each phase: which reports that will be generated (and which will not be), which files will be zipped and moved, which files will be uploaded to the sftp server, and which files will be downloaded from it (it logs on and lists the files). Looking back at the project, I realized that I ended up using the -dry-run option pretty much every day. Benefits I am surprised how useful I found it to be. I often used it as a check before getting started. Since I know -dry-run will not change anything, it is safe to run without thinking. I can immediately see that everything is accessible, that the configuration is correct, and that the state is as expected. It is a quick and easy sanity check. I also used it quite a bit when testing the complete system. For example, if I changed a date in the report state file (the date for the last successful report of a given type), I could immediately see from the output whether it would now be generated or not. Without -dry-run, the actual report would also be generated, which takes some time. So I can test the behavior, and receive very quick feedback. Downside The downside is that the dryRun-flag pollutes the code a bit. In all the major phases, I need to check if the flag is set, and only print the action that will be taken, but not actually doing it. However, this doesn't go very deep. For example, none of the code that actually generates the report needs to check it. I only need to check if that code should be invoked in the first place. Conclusion The type of application I have been writing is ideal for -dry-run. It is invoked by a command, and it may create some changes, for example generating new reports. More reactive applications (that wait for messages before acting) don't seem to be a good fit. I added -dry-run on a whim early on in the project. I was surprised at how useful I found it to be. Adding it early was also good, since I got the benefit of it while developing more functionality. The -dry-run flag is not for every situation, but when it fits, it can be quite useful. Share this: * Share on X (Opens in new window) X * Share on Facebook (Opens in new window) Facebook * Share on LinkedIn (Opens in new window) LinkedIn * Like Loading... Related This entry was posted in Programming, Testing and tagged command, dry-run, programming, testing. Bookmark the permalink. - Lessons From 9 More Years of Tricky Bugs 4 responses to "In Praise of -dry-run" 1. andomar's avatar andomar | January 31, 2026 at 7:24 pm | Reply Faster debugging is a big help! It's worth some extra code. 2. Henrik Warne's avatar Henrik Warne | February 1, 2026 at 7:50 am | Reply Reddit discussion: https://www.reddit.com/r/programming/comments/ 1qse1g5/in_praise_of_dryrun/ Hacker News discussion: https://news.ycombinator.com/item?id= 46840612 3. hughdbrown's avatar hughdbrown | February 1, 2026 at 8:34 am | Reply I often write code so that it does not perform file system actions but instead writes the equivalent action to stdout. When I am satisfied with the actions, I pipe them to bash/sh/zsh. Effectively, I use dry-run all the time and pipe to run the side effects. 4. Henrik Warne's avatar Henrik Warne | February 1, 2026 at 12:37 pm | Reply Lobsters discussion: https://lobste.rs/s/jnttzy/praise_dry_run Leave a comment Cancel reply [ ] [ ] [ ] [ ] [ ] [ ] [ ] D[ ] * MOST POPULAR + Lessons Learned in Software Development + Top 5 Surprises When Starting Out as a Software Developer + Working as a Software Developer + Great Programmers Write Debuggable Code + What Makes a Good Programmer * RECENT POSTS + In Praise of -dry-run + Lessons From 9 More Years of Tricky Bugs + More Good Programming Quotes, Part 6 + Programming Conference - Jfokus Stockholm 2025 + My Simple Knowledge Management and Time Tracking System + Programming With ChatGPT + John von Neumann - The Man from the Future + Finding a New Software Developer Job + Tidy First? + What I Have Changed My Mind About in Software Development + Well-maintained Software + Algorithmic Trading: A Practitioner's Guide + There Is No Software Maintenance + Switching to Go - First Impressions + Effective Software Testing - A Developer's Guide + On Code Reviews + Book Review: A Philosophy of Software Design + On Comments in Code + 4 Things I Like About Microservices + Recruiting Software Developers - Coding Tests + More Good Programming Quotes, Part 5 + 6 Small Unit Testing Tips + Mathematical Modelling of Football + Deployed To Production Is Not Enough + Good Logging + Working From Home - Cons and Pros + Artificial Intelligence - A Guide for Thinking Humans + 20.5 Years of XP and Agile + Secure by Design + More Good Programming Quotes, Part 4 + Grokking Deep Learning + EuroSTAR Testing Conference Prague 2019 + Classic Computer Science Problems in Python + When TDD Is Not a Good Fit + Recruiting Software Developers - Checking Out a Company + Book Review: Designing Data-Intensive Applications + Nordic Testing Days Tallinn 2019 + Book review: Accelerate + More Good Programming Quotes, Part 3 + Programming: Math or Writing? + Developer On Call + My Favorite Command-Line Shortcuts + 6 Git Aha Moments + Is Manual Testing Needed? + Exercises in Programming Style + Programming for Grade 8 + 6 Years of Thoughts on Programming + Benefits of Continuous Delivery + More Good Programming Quotes, Part 2 + Developer Testing + Programming Conference - QCon New York 2017 + Developers - Talk To People + Code Rot + Programmer Career Planning + Software Development and the Gig Economy + Book Review: The Effective Engineer + Things Programmers Say + Developer Book Club + Book Review: Release It! + 18 Lessons From 13 Years of Tricky Bugs + Learning From Your Bugs + More Good Programming Quotes + The Wisdom of Programming Quotes + Ph.D. or Professional Programmer? + Social Engineering from Kevin Mitnick + Recruiting Software Developers - Initial Contact + Coursera Course Review: Software Security + Lessons Learned in Software Development + Book Review: Clean Code + Coursera Course Review: Computational Investing Part 1 + Programmer Knowledge + 5 Reasons Why Software Developer is a Great Career Choice + A Response to "Why Most Unit Testing is Waste" + What Makes a Good Programmer? + Switching from Java to Python - First Impressions + Antifragility and Software Development + 5 Unit Testing Mistakes + Unit Testing Private Methods + A Bug, a Trace, a Test, a Twist + Session-based Logging + Finding Bugs: Debugger versus Logging + TDD, Unit Tests and the Passage of Time + Automatically Include Revision in Log Statement + 7 Ways More Methods Can Improve Your Program + LinkedIn - Good or Bad? + Great Programmers Write Debuggable Code + SET Card Game Variation - Complementary Pairs + Programmer Productivity - Interruptions, Meetings and Working Remotely + What Do Programmers Want? + Coursera course review: Algorithms: Design and Analysis, Part 2 + Blog stats for 2012 (by WordPress) + Working as a Software Developer + 4 Reasons Why Bugs Are Good For You + Book Review: How Google Tests Software + Top 5 Surprises When Starting Out as a Software Developer + Programmer Productivity: Emacs versus IntelliJ IDEA + Why I Love Coding + Coursera course review: Design and Analysis of Algorithms I + Mac OS X Break Programs Review + Favorite Programming Quotes + How I Beat Repetitive Stress Injury + Introduction to Databases - On-line Learning Done Well + 10 million SET games simulated using "Random among 'most similar' Sets" + 10 million SET games simulated using "Random among available Sets" + 10 million SET games simulated using "First found Set" + SET(r) Probabilities Revisited * TAG CLOUD algorithms book book review break program bugs career code coding conference coursera creativity databases debugging developer testing DevOps emacs ergonomics face to face Google hiring history ide idea integration testing intellij interruption interviewing java job knowledge learning linkedin logging love machine learning Mac OS X math mathematics meeting meta methods office on-line course probabilities production software productivity professional software development programmer programming programming course programming job python quotes recruiting refactoring Repetitive Stress Injury review RSI security SET game simulation software development statistics stats stretches surprises tdd test-driven development testing trouble-shooting unit-test unit testing university work working * RSS + RSS - Posts + RSS - Comments * Follow Blog via Email Enter your email address to follow this blog and receive notifications of new posts by email. Email Address: [ ] Follow Join 411 other subscribers Create a free website or blog at WordPress.com. * Comment * Reblog * Subscribe Subscribed + [wpcom-] Henrik Warne's blog Join 411 other subscribers [ ] Sign me up + Already have a WordPress.com account? Log in now. * Privacy * + [wpcom-] Henrik Warne's blog + Subscribe Subscribed + Sign up + Log in + Copy shortlink + Report this content + View post in Reader + Manage subscriptions + Collapse this bar Loading Comments... Write a Comment... [ ] Email (Required) [ ] Name (Required) [ ] Website [ ] [Post Comment] %d [b]